package com.hx.nacosconfig.controller;

import org.springframework.beans.factory.annotation.Value;
import org.springframework.cloud.context.config.annotation.RefreshScope;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;
import static org.springframework.web.bind.annotation.RequestMethod.GET;


/**
 * @author chm
 * @title: ConfigController
 * @projectName NacosSpringBoot
 * @description: TODO
 * @date 2020/3/415:34
 */
@RestController
@RequestMapping("/config")
@RefreshScope
public class ConfigController {

    @Value("${nacosConfig:}")
    private String username;

    @RequestMapping(value = "/get", method = GET)
    @ResponseBody
    public String get() {
        return username;
    }
}